<?php include "../public/header.php";?>
<?php include "../public/header_show.php";?>
<body id="xiangqingPage">
<div id="xiangqingBox">
    <div class="page-title">
        <div class="page-title-con">
            <span class="pageshowtitle">详情</span>
            <div class="page-title-opt-list">
                <?php include "../public_flow/flow_show_optbut.php";?>
                <button class="layui-btn layui-btn-sm btn-light marginr5 opt">
                    操作<i class="layui-icon layui-icon-down layui-font-12"></i>
                </button>
                <span id="page-close" class="page-close" onclick="layer_close()">×</span>
            </div>
        </div>
    </div>
    <div class="main-container">

        <div><?php include "../public_flow/flow_show_info.php";?></div>

        <div class="table-box tablenes">
            <div class="title">基本信息</div>
            <table class="layui-table">
                <tbody>

                <tr><td class="tt">收票登记单号</td><td id="number" colspan="3" class="tv"></td></tr>
                <tr><td class="tt">工程名称</td><td id="enginname" class="colorlan tv"></td><td class="tt">合同金额(元)</td><td id="shimoney" class="tv colorlan"></td></tr>
                <tr><td class="tt">收票金额(元)</td><td class="tv" id="money" colspan="3"></td></tr>
                <tr><td class="tt">备注</td><td class="tv" id="explain" colspan="3"></td></tr>
                </tbody>
            </table>
        </div>

        <div><?php include "../public/upinfo_show.php";?></div>

        <div><?php include "../public_flow/flow_show_flowrelas.php";?></div>

        <div class="table-box tablenes">
            <script type="text/html" id="toolbarDemo">发票明细</script>
            <div class="tableShow">
                <table id="datalist" lay-filter="datalist"></table>
            </div>
        </div>

        <div class="table-box tablenes">
            <script type="text/html" id="toolbarDemo_payen">相关付款流程</script>
            <div class="tableShow">
                <table id="datalist_payen" lay-filter="datalist_payen"></table>
            </div>
        </div>

        <div><?php include '../public_flow/flow_show_shenlog.php'?></div>
        <div><?php include '../public_flow/flow_show_talk.php'?></div>
        <div><?php include '../public/opt_browse.php'?></div>
    </div>
</div>
<script>
    var param_id = getQueryVariable('id') || 0;

    layui.use(['form', 'layer', "laytp",'element','dropdown','laypage','table','soulTable'], function() {
        var laypage = layui.laypage, table = layui.table, dropdown = layui.dropdown, form = layui.form, soulTable = layui.soulTable,element = layui.element;

        facade.ajax({url: ask_piao_put_show, data:{id: param_id}}).done(function(res){
            if (res.code === 2000) {
                var data = res.data.data;
                var engininfo = res.data.engininfo;
                var shiinfo = res.data.shiinfo;

                if(engininfo){
                    $("#enginname").text(engininfo.name).click(function () {
                        openPage('../engin/show.php?id='+engininfo.id);
                    });
                    if(shiinfo){
                        $("#shimoney").text(shiinfo.money).click(function () {
                            openPage('../contract_shi/show.php?id='+shiinfo.id);
                        });
                    }

                }




                $("#number").text(data.number);
                $("#money").text(data.money);
                $("#explain").text(data.explain);



                var mytableList = table.render({
                    elem: "#datalist",data:res.data.list, toolbar: '#toolbarDemo', page: false
                    ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                    ,defaultToolbar: TabInitShow.defaultToolbar,filter: TabInitShow.filter ,text: TabInitShow.text,totalRow: true
                    ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                    , cols: [[
                        {type:'numbers',title:'序号',totalRowText: '合计'}
                        ,{field: 'gonger', title: '销售方名称'}
                        ,{field: 'dt', title: '开票日期'}
                        ,{field: 'piaotype_name', title: '发票类型'}
                        ,{field: 'nums', title: '发票号码'}
                        ,{field: 'fee', title: '不含税金额(元)',totalRow: true}
                        ,{field: 'rate', title: '税率(%)'}
                        ,{field: 'ratefee', title: '税额(元)',totalRow: true}
                        ,{field: 'money', title: '价税合计(元)',totalRow: true}
                        ,{field: 'dengdt', title: '登记日期'}
                        ,{field:'',title:'附件',templet: function(d){
                                if(d.filearr.length > 0){

                                    return '<span class="colorlan" onclick="openTabFilePage(\'xunfiles'+d.id+'\')">' +
                                        '<span class="layui-hide xunfiles'+d.id+'">'+JSON.stringify(d.filearr)+'</span>' +
                                        '<i class="layui-icon layui-icon-link"></i>' +
                                        '</span>';
                                }
                                return '';
                            }}
                        ,{field:'leiputfee',title:'累计成本票(元)',templet: function(d){
                                return '<span class="colorlan" onclick="openPage(\'../piao_put_ming/tong.php?gonger='+encodeURI(d.gonger)+'&enginid='+d.enginid+'\')">'+d.leiputfee+'</span>';
                            }}
                        ,{field: 'jinbi', title: '进项金额占比(%)'}
                        ,{field: 'explain', title: '备注'}
                    ]]
                    , done: function (res) {
                        soulTable.render(this);
                    }
                });

                var mytableList22 = table.render({
                    elem: "#datalist_payen",data:res.data.payinfo, toolbar: '#toolbarDemo_payen', page: false
                    ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                    ,defaultToolbar: TabInitShow.defaultToolbar,filter: TabInitShow.filter ,text: TabInitShow.text,totalRow: true
                    ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                    , cols: [[
                        {type:'numbers',title:'序号',totalRowText: '合计'}
                        ,{field:'number',title:'付款编号',templet: function(d){
                                return '<span class="colorlan" onclick="openPage(\'../payment_engin/show.php?id='+d.payenid+'\')">'+d.number+'</span>';
                            }}
                        ,{field: 'qingdt', title: '请款日期'}
                        ,{field: 'gonger', title: '付款对象'}
                        ,{field: 'money', title: '请款金额(元)',totalRow: true}
                        ,{field: 'payfee', title: '已支付金额(元)',totalRow: true}
                        ,{field: 'paydt', title: '支付日期'}
                        ,{field: 'paystatus', title: '支付状态'}
                    ]]
                    , done: function (res) {
                        soulTable.render(this);
                    }
                });


                public_flow_show_display(res.data.billinfo);
                public_upload_show_file('upload_files', res.data.files);
                render_from();
            }
        });

        public_get_readsandlog('piao_put', param_id);
    });



</script>
</body>
</html>




